/*commented gen files are reminders of how variables were created*/

/*change path as necessary*/
use "C:Preaching to the Choir\Stata files\Dataverse files\Data2017survey.dta"

eststo clear

/* belief variables: Likert 1-5, lower number means agree more that waste causes problem; choir sample if <=2
*/

/* belief variables: Likert 1-5, lower number means agree more that waste causes problem
so variables are reverse coded:
gen ch_nature_r = ch_nature * -1
gen ch_litter_r = ch_litter * -1
gen ch_energy_r = ch_energy * -1
gen ch_landfills_r = ch_landfills * -1
gen nature_pre_r = nature_pre * -1
gen litter_pre_r = litter_pre * -1
gen energy_pre_r = energy_pre * -1
gen landfills_pre_r = landfills_pre * -1
*/

reg ch_nature_r video text if nature_pre_r >= -2, nocon
eststo naturechgc,title ("Reducing waste is a major way to conserve natural resources") 

reg ch_nature_r video text if nature_pre_r < -2, nocon
eststo naturechgn,title ("Reducing waste is a major way to conserve natural resources") 

reg ch_litter_r video text if litter_pre_r >= -2, nocon
eststo litterchgc,title ("Reducing waste is a major way to reduce litter") 

reg ch_litter_r video text if litter_pre_r < -2, nocon
eststo litterchgn,title ("Reducing waste is a major way to reduce litter") 

reg ch_energy_r video text if energy_pre_r >= -2, nocon
eststo energychgc,title ("Reducing waste is a major way to conserve energy") 

reg ch_energy_r video text if energy_pre_r < -2, nocon
eststo energychgn,title ("Reducing waste is a major way to conserve energy") 

reg ch_landfills_r video text if landfills_pre_r >= -2, nocon
eststo landfillschgc,title ("Reducing waste is a major way to reduce landfills") 

reg ch_landfills_r video text if landfills_pre_r < -2, nocon
test video=text
eststo landfillschgn,title ("Reducing waste is a major way to reduce landfills") 

esttab naturechgc naturechgn litterchgc litterchgn energychgc energychgn landfillschgc landfillschgn using Table1, b(2) not star nonum obslast label title("Table 1: Split Sample Results for 2017 Survey Changes in beliefs") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01, and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs; when necessary, variables are reverse coded to accomplish this.") mtitles rtf replace
/*table needs reformatting*/

/*estimate models with interactions to see if choir and nonbeliever coefficients are statistically different
gen videonatc = video*(nature_pre <=2)
gen textnatc = text*(nature_pre<=2)
gen videolitc=video*(litter_pre<=2)
gen textlitc=text*(litter_pre<=2)
gen videoenc=video*(energy_pre<=2)
gen textenc=text*(energy_pre<=2)
gen videolandfc=video*(landfills_pre<=2)
gen textlandfc=text*(landfills_pre<=2)
*/

reg ch_nature video videonatc text textnatc,nocon
testparm videonatc textnatc
reg ch_litter video videolitc text textlitc,nocon
testparm videolitc textlitc
reg ch_energy video videoenc text textenc,nocon
testparm videoenc textenc
reg ch_landfills video videolandfc text textlandfc,nocon
testparm videolandfc textlandfc

/*attitudes, sense of responsibility, and personal norms
good: continuous scale 1-5, higher means reducing, reusing, recycling is more good
obligation: continuous scale 1-5, higher means stronger obligation to reduce/reuse/recycle
guilty: continuous scale 1-5, lower means stronger feeling of guilt if they don't reduce/reuse/recycle. So reverse-code:
*/

/*
gen guilty_r = guilty * -1
gen guilty_pre_r = guilty_pre * -1
*/

reg ch_good video text if good_pre >= 3.5,nocon
eststo goodchgc, title("Reducing waste is good")

reg ch_good video text if good_pre < 3.5,nocon
eststo goodchgn, title("Reducing waste is good") 

reg ch_obligation video text if obligation_pre >= 3.5,nocon
eststo obligchgc, title ("Strong obligation to reduce waste")

reg ch_obligation video text if obligation_pre < 3.5,nocon
eststo obligchgn, title ("Strong obligation to reduce waste")

reg ch_guilty_r video text if guilty_pre_r >= -2.5, nocon
eststo guiltychgc, title ("Stronger feeling of guilt") 

reg ch_guilty_r video text if guilty_pre_r < -2.5, nocon
eststo guiltychgn, title ("Stronger feeling of guilt") 

esttab goodchgc goodchgn obligchgc obligchgn guiltychgc guiltychgn using Table2, b(2) not star nonum obslast label title("Table 2: Split Sample Results for 2017 Survey Changes in Attitudes, Sense of Responsibility, and Personal Norms") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01, and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs; when necessary, variables are reverse coded to accomplish this.") mtitles rtf replace
/*table needs reformatting*/

/*estimate models with interactions to see if choir and nonbeliever coefficients are statistically different
gen videoobc=video*(obligation_pre>=3.5)
gen textobc=text*(obligation_pre>=3.5)
gen videogoodc=video*(good_pre>=3.5)
gen textgoodc=text*(good_pre>=3.5)
gen videoguiltyc=video*(guilty_pre<=2.5)
gen textguiltyc=text*(guilty_pre<=2.5)
gen videointc=video*(intended_pre>=3.5)
gen textintc=text*(intended_pre>=3.5)
*/

reg ch_good video videogoodc text textgoodc,nocon
testparm videogoodc textgoodc
reg ch_obligation video videoobc text textobc,nocon
testparm videoobc textobc
reg ch_guilty_r video videoguiltyc text textguiltyc,nocon
testparm videoguiltyc textguiltyc

/*intended variables: Likert 1-5, higher number means more likely to reduce/reuse/recycle
*/

reg ch_intended video text if intended_pre >=3.5, nocon
eststo intendedchgc, title ("More reduce/reuse/recycle") 

reg ch_intended video text if intended_pre <3.5, nocon
eststo intendedchgn, title ("More reduce/reuse/recycle")

esttab intendedchgc intendedchgn using Table3, b(2) scalars(p_value) not star nonum obslast label title("Table 3: Split Sample Results from 2017 survey Changes in Intended Behavior") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01. and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs.") mtitles rtf replace
/*table needs reformatting*/

/*estimate models with interactions to see if choir and nonbeliever coefficients are statistically different
gen videointc=video*(intended_pre>=3.5)
gen textintc=text*(intended_pre>=3.5)
*/

reg ch_intended video videointc text textintc,nocon
testparm videointc textintc

/*change path as necessary*/
use "C:Preaching to the Choir\Stata files\Dataverse files\Data201516surveys.dta"

/*
reminder of how choir and nonbeliever subsets are defined
gen yeslitter = .
replace yeslitter = 2 if q57_2 >=4
replace yeslitter=0 if q57_2 <4
gen yeslandfill = .
replace yeslandfill = 2 if q57_2 >=4
replace yeslandfill = 0 if q57_2 < 4
gen yesocean = .
replace yesocean=2 if q57_3 >=4
replace yesocean = 0 if q57_3 <4

gen yesindividual = q32 <= 2
replace yesindividual = . if q32 == .
gen yesresponsibility = q33 >= 4
replace yesresponsibility = . if q33 ==.
*/

/* chq31 and q31r are reverse coded:
gen chq31r = chq31 * (-1)
gen q31r = q31 * -1 
*/

eststo clear

reg chq31r sawtext sawart sawphototext sawartonly if yesindividual == 1 , nocon
eststo chq31rchoir,title ("Individual actions matter^") 
reg chq31r sawtext sawart sawphototext sawartonly if yesindividual == 0 , nocon
eststo chq31rnon,title ("Individual actions matter^") 

reg chq33 sawtext sawart sawphototext sawartonly if yesresponsibility == 1 , nocon
eststo chq33choir,title ("Personal responsibility") 
reg chq33 sawtext sawart sawphototext sawartonly if yesresponsibility == 0 , nocon
eststo chq33non,title ("Personal responsibility") 

esttab chq31rchoir chq31rnon chq33choir chq33non using Table4, b(2) not star nonum obslast label title("Table 4: Split Sample Results for 2015-16 Surveys Changes in General Attitudes and Beliefs") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01, and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs; when necessary, variables are reverse coded to accomplish this.") mtitles rtf replace
/*table needs reformatting*/

/*Now estimate models for full sample with choir dummy and interactions in order to test whether nonbeliever coefficients are statistically larger than choir coefficients. Then add ^ notations to tables
*/

/*gen sawtextc31 = sawtext*yesindividual
gen sawartc31 = sawart*yesindividual
gen sawphototextc31=sawphototext*yesindividual
gen sawartonlyc31=sawartonly*yesindividual*/
reg chq31r sawtext sawtextc31 sawart sawartc31 sawphototext sawphototextc31 sawartonly sawartonlyc31, nocon 
testparm sawtextc31 sawartc31 sawphototextc31 sawartonlyc31

/*gen sawtextc33 = sawtext*yesresponsibility
gen sawartc33=sawart*yesresponsibility
gen sawphototextc33=sawphototext*yesresponsibility
gen sawartonlyc33=sawartonly*yesresponsibility*/
reg chq33 sawtext sawtextc33 sawart sawartc33 sawphototext sawphototextc33 sawartonly sawartonlyc33, nocon 
testparm sawtextc33 sawartc33 sawphototextc33 sawartonlyc33

reg chq57_1 sawtext sawart sawphototext sawartonly if yeslitter==1 , nocon
eststo ch571choir,title ("Litter") 
reg chq57_1 sawtext sawart sawphototext sawartonly if yeslitter==0 , nocon
eststo ch571non,title ("Litter") 

reg chq57_2 sawtext sawart sawphototext sawartonly if yeslandfill == 1 , nocon
eststo ch572choir,title ("Landfill pollution") 
reg chq57_2 sawtext sawart sawphototext sawartonly if yeslandfill == 0 , nocon
eststo ch572non,title ("Landfill pollution") 

reg chq57_3 sawtext sawart sawphototext sawartonly if yesocean == 1 , nocon
eststo ch573choir,title ("Ocean pollution") 
reg chq57_3 sawtext sawart sawphototext sawartonly if yesocean == 0 , nocon
eststo ch573non,title ("Ocean pollution") 

esttab ch571choir ch571non ch572choir ch572non ch573choir ch573non using Table5, b(2) scalars(p_diff) not star nonum obslast compress label title("Table 5: Split Sample Results for 2015-16 Surveys Changes in Beliefs about Plastic Pollution") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01, and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs.") mtitles rtf alignment(l) replace
/*table needs reformatting*/

/*Now estimate models for full sample with choir dummy and interactions in order to test whether nonbeliever coefficients are statistically larger than choir coefficients. Then add ^ notations to tables
*/

/*gen sawtextc571 = sawtext*yeslitter
gen sawartc571=sawart*yeslitter
gen sawphototextc571=sawphototext*yeslitter
gen sawartonlyc571 = sawartonly*yeslitter*/
reg chq57_1 sawtext sawtextc571 sawart sawartc571 sawphototext sawphototextc571 sawartonly sawartonlyc571, nocon 
testparm sawtextc571 sawartc571 sawphototextc571 sawartonlyc571

/*gen sawtextc572 = sawtext*yeslandfill
gen sawartc572=sawart*yeslandfill
gen sawphototextc572=sawphototext*yeslandfill
gen sawartonlyc572=sawartonly*yeslandfill*/
reg chq57_2 sawtext sawtextc572 sawart sawartc572 sawphototext sawphototextc572 sawartonly sawartonlyc572, nocon
testparm sawtextc572 sawartc572 sawphototextc572 sawartonlyc572

/*gen sawtextc573 = sawtext*yesocean
gen sawartc573=sawart*yesocean
gen sawphototextc573=sawphototext*yesocean
gen sawartonlyc573=sawartonly*yesocean*/
reg chq57_3 sawtext sawtextc573 sawart sawartc573 sawphototext sawphototextc573 sawartonly sawartonlyc573, nocon
testparm sawtextc573 sawartc573 sawphototextc573 sawartonlyc573

/*change path as necessary*/
use "C:Preaching to the Choir\Stata files\Dataverse files\Data2020survey.dta"

eststo clear

/*reminder of how groups are defined
gen yeslitter = .
replace yeslitter = 1 if q57_1 >=4
replace yeslitter=0 if q57_1 <4
gen yeslandfill = .
replace yeslandfill = 1 if q57_2 >=4
replace yeslandfill = 0 if q57_2 < 4
gen yesocean = .
replace yesocean=1 if q57_3 >=4
replace yesocean = 0 if q57_3 <4

gen yesindividual = q31 <= 2
replace yesindividual = . if q31 == .
gen yesresponsibility = q33 >= 4
replace yesresponsibility = . if q33 ==.
*/

/*reminder of reverse coded q31 and chq31
gen q31r = q31 * -1
gen chq31r = chq31 * -1
*/

reg chq31r sawtext sawart sawphototext if yesindividual == 1 , nocon
eststo chq31rchoir,title ("Individual actions matter^") 
reg chq31r sawtext sawart sawphototext if yesindividual == 0 , nocon
eststo chq31rnon,title ("Individual actions matter^") 

reg chq33 sawtext sawart sawphototext if yesresponsibility == 1 , nocon
eststo chq33choir,title ("Personal responsibility") 
reg chq33 sawtext sawart sawphototext if yesresponsibility == 0 , nocon
eststo chq33non,title ("Personal responsibility") 

esttab chq31rchoir chq31rnon chq33choir chq33non using Table6, b(2) not star nonum obslast label title("Table 6: Split Sample Results for 2020 Survey Changes in General Attitudes and Beliefs") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01, and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs; when necessary, variables are reverse coded to accomplish this.") mtitles rtf replace

/*Now estimate models for full sample with choir dummy and interactions in order to test whether nonbeliever coefficients are statistically larger than choir coefficients. Then add ^ notations to tables
*/

/*gen sawtextc31 = sawtext*yesindividual
gen sawartc31 = sawart*yesindividual
gen sawphototextc31=sawphototext*yesindividual
*/
reg chq31r sawtext sawtextc31 sawart sawartc31 sawphototext sawphototextc31, nocon 
testparm sawtextc31 sawartc31 sawphototextc31

/*gen sawtextc33 = sawtext*yesresponsibility
gen sawartc33=sawart*yesresponsibility
gen sawphototextc33=sawphototext*yesresponsibility
*/
reg chq33 sawtext sawtextc33 sawart sawartc33 sawphototext sawphototextc33, nocon 
testparm sawtextc33 sawartc33 sawphototextc33 

reg chq57_1 sawtext sawart sawphototext if yeslitter==1 , nocon
eststo ch571choir,title ("Litter") 
reg chq57_1 sawtext sawart sawphototext  if yeslitter==0 , nocon
eststo ch571non,title ("Litter") 

reg chq57_2 sawtext sawart sawphototext  if yeslandfill == 1 , nocon
eststo ch572choir,title ("Landfill pollution") 
reg chq57_2 sawtext sawart sawphototext  if yeslandfill == 0 , nocon
eststo ch572non,title ("Landfill pollution") 

reg chq57_3 sawtext sawart sawphototext  if yesocean == 1 , nocon
eststo ch573choir,title ("Ocean pollution") 
reg chq57_3 sawtext sawart sawphototext if yesocean == 0 , nocon
eststo ch573non,title ("Ocean pollution") 

esttab ch571choir ch571non ch572choir ch572non ch573choir ch573non using Table7, b(2) scalars(p_diff) not star nonum obslast compress label title("Table 5: Split Sample Results for 2020 Survey Changes in Beliefs about Plastic Pollution") addnotes("Notes:*,**,***: statistically different than zero at .05, .01, and .001 levels, respectively; ^,^^,^^^: statistically different than corresponding Choir coefficient at .05, .01, and .001 levels, respectively. Higher coefficient values indicate more pro-environmental beliefs.") mtitles rtf alignment(l) replace
/*table needs reformatting*/

/*Now estimate models for full sample with choir dummy and interactions in order to test whether nonbeliever coefficients are statistically larger than choir coefficients. Then add ^ notations to tables
*/

/*gen sawtextc571 = sawtext*yeslitter
gen sawartc571=sawart*yeslitter
gen sawphototextc571=sawphototext*yeslitter
*/
reg chq57_1 sawtext sawtextc571 sawart sawartc571 sawphototext sawphototextc571, nocon 
testparm sawtextc571 sawartc571 sawphototextc571

/*gen sawtextc572 = sawtext*yeslandfill
gen sawartc572=sawart*yeslandfill
gen sawphototextc572=sawphototext*yeslandfill
*/
reg chq57_2 sawtext sawtextc572 sawart sawartc572 sawphototext sawphototextc572, nocon
testparm sawtextc572 sawartc572 sawphototextc572

/*gen sawtextc573 = sawtext*yesocean
gen sawartc573=sawart*yesocean
gen sawphototextc573=sawphototext*yesocean
*/
reg chq57_3 sawtext sawtextc573 sawart sawartc573 sawphototext sawphototextc573, nocon
testparm sawtextc573 sawartc573 sawphototextc573

